package atom 
{
	import atom.loader.library.LibraryLoader;
	import atom.net.Link;
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author Jorge Braccini
	 */
	public class Atom {
		
		private static var _link:Link;
		private static var _library:LibraryLoader;
		private static var _atom:Atom;
		
		public static var onReady:Function;
		public static var context:Sprite;
		
		/////////////////////////////////////////
		// Static Methods ///////////////////////
		/////////////////////////////////////////
		
		public static function initialize(context:Sprite):void {
			context = context;
			
			_link = new Link("127.0.0.1", 8050);
			_link.addEventListener(Event.CONNECT, handleConnect);
			
			_library = new LibraryLoader();
			
			_atom = new Atom(new Force());
		}
		
		public static function get link():Link {
			return _link;
		}
		
		public static function get library():LibraryLoader {
			return _library;
		}
		
		private static function handleConnect(e:Event):void {
			if (onReady != null) onReady();
		}
		
		/////////////////////////////////////////
		// Class ////////////////////////////////
		/////////////////////////////////////////
		
		public function Atom(force:Force) {
			init();
		}
		
		
		
		/////////////////////////////////////////
		// Public Methods ///////////////////////
		/////////////////////////////////////////
		
		/////////////////////////////////////////
		// Private Methods //////////////////////
		/////////////////////////////////////////
		
		private function init():void {
			
		}
		
		/////////////////////////////////////////
		// Properties ///////////////////////////
		/////////////////////////////////////////
		
	}

}

class Force { };